GetFrontProcess
GetFrontProcess Get serial number of foreground process
OSErr GetFrontProces (PSN);
ProcessSerialNumber *PSN ; a pointer to a foreground process's serial number
returns Error Code; 0=no error
You use the GetFrontProcess to get the process serial number of the
foreground process.
PSN is a pointer to the process serial number of the process running in
the foreground
Returns: an operating system Error Code.
noErr (0) No error
paramErr (-50) Process serial number is invalid
procNotFound (-600) No process in the foreground

Notes: You can use this function to determine if your process or some other
process is in the foreground. You can use the process serial number
returned in the PSN parameter in other Process Manager routines.
If no process is running in the foreground, GetFrontProcess returns the
result code procNotFound.